﻿using System;
using System.Collections;
using Core;
using UnityEngine;

namespace Core
{
    public struct LoadScene : IEventData
    {
        public string scenePath;
        public object data;

        public LoadScene(string path) : this(path, null) { }

        public LoadScene(string path, object data)
        {
            scenePath = path;
            this.data = data;
        }
    }

    public struct OnLoadSceneBegin : IEventData
    {
        public string path;
    }

    public struct OnLoadSceneProgress : IEventData
    {
        public float progress;

        public OnLoadSceneProgress(float progress)
        {
            this.progress = progress;
        }
    }

    public struct OnLoadSceneEnd : IEventData 
    {
        public string path;
        public OnLoadSceneEnd(string path)
        {
            this.path = path;
        }
    }

    public struct OpenPanel : IEventData
    {
        public string path;
        public object data;

        public OpenPanel(string path) : this(path, null) { }

        public OpenPanel(string path, object data)
        {
            this.path = path;
            this.data = data;
        }
    }

    public struct OnOpenPanelEnd : IEventData
    {
        public string path;
    }

    public struct ClosePanel : IEventData
    {
        public string path;

        public ClosePanel(string path)
        {
            this.path = path;
        }
    }

    public struct CloseLayerPanels : IEventData
    {
        public PanelLayerType layer;

        public CloseLayerPanels(PanelLayerType layer)
        {
            this.layer = layer;
        }
    }

    public struct OnClosePanelEnd : IEventData 
    {
        public string path;
    }

    public struct GetActivePanel : IEventData
    {
        public string path;

        public GetActivePanel(string path)
        {
            this.path = path;
            this.panel = null;
        }

        public BasePanel panel;
    }

    public struct StartCoroutine : IEventData
    {
        public IEnumerator handler;

        public StartCoroutine(IEnumerator handler)
        {
            this.handler = handler;
            this.coroutine = null;
        }

        public Coroutine coroutine;
    }
}
